import { BuildPrinter } from "../../common/hooks";
function costVitePlugin(name: string, hook?: BuildPrinter): any {
  const hooks = hook || new BuildPrinter(name);
  hooks.start();
  return {
    name: "CostVitePlugin",
    buildStart() {
      hooks.loaded();
    },
    // buildEnd() {
    //   hooks.compiled();
    // },
    closeBundle() {
      // 将build + output作为整体来计算编译耗时更加合理
      hooks.compiled();
      hooks.done();
    },
  };
}

export { costVitePlugin };
